/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EC;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author TrangNHIT
 */
@Entity
@Table(name = "tbProducts")
@NamedQueries({
    @NamedQuery(name = "Products.findAll", query = "SELECT p FROM Products p"),
    @NamedQuery(name = "Products.findByProID", query = "SELECT p FROM Products p WHERE p.proID = :proID"),
    @NamedQuery(name = "Products.findByProQuantity", query = "SELECT p FROM Products p WHERE p.proQuantity = :proQuantity"),
    @NamedQuery(name = "Products.findByProName", query = "SELECT p FROM Products p WHERE p.proName = :proName"),
    @NamedQuery(name = "Products.findByProUnit", query = "SELECT p FROM Products p WHERE p.proUnit = :proUnit"),
    @NamedQuery(name = "Products.findByProPrice", query = "SELECT p FROM Products p WHERE p.proPrice = :proPrice")})
public class Products implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Pro_ID")
    private Integer proID;
    @Basic(optional = false)
    @Column(name = "Pro_Quantity")
    private int proQuantity;
    @Basic(optional = false)
    @Column(name = "Pro_Name")
    private String proName;
    @Basic(optional = false)
    @Column(name = "Pro_Unit")
    private String proUnit;
    @Basic(optional = false)
    @Column(name = "Pro_Price")
    private double proPrice;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "products")
    private List<OrderDetails> orderDetailsList;
    @JoinColumn(name = "State_ID", referencedColumnName = "State_ID")
    @ManyToOne(optional = false)
    private States states;
    @JoinColumn(name = "Category_ID", referencedColumnName = "Category_ID")
    @ManyToOne(optional = false)
    private Categories categories;
    @JoinColumn(name = "Brand_ID", referencedColumnName = "Brand_ID")
    @ManyToOne(optional = false)
    private Brands brands;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "products")
    private List<SaleOff> saleOffList;

    public Products() {
    }

    public Products(Integer proID) {
        this.proID = proID;
    }

    public Products(Integer proID, int proQuantity, String proName, String proUnit, double proPrice) {
        this.proID = proID;
        this.proQuantity = proQuantity;
        this.proName = proName;
        this.proUnit = proUnit;
        this.proPrice = proPrice;
    }

    public Integer getProID() {
        return proID;
    }

    public void setProID(Integer proID) {
        this.proID = proID;
    }

    public int getProQuantity() {
        return proQuantity;
    }

    public void setProQuantity(int proQuantity) {
        this.proQuantity = proQuantity;
    }

    public String getProName() {
        return proName;
    }

    public void setProName(String proName) {
        this.proName = proName;
    }

    public String getProUnit() {
        return proUnit;
    }

    public void setProUnit(String proUnit) {
        this.proUnit = proUnit;
    }

    public double getProPrice() {
        return proPrice;
    }

    public void setProPrice(double proPrice) {
        this.proPrice = proPrice;
    }

    public List<OrderDetails> getOrderDetailsList() {
        return orderDetailsList;
    }

    public void setOrderDetailsList(List<OrderDetails> orderDetailsList) {
        this.orderDetailsList = orderDetailsList;
    }

    public States getStates() {
        return states;
    }

    public void setStates(States states) {
        this.states = states;
    }

    public Categories getCategories() {
        return categories;
    }

    public void setCategories(Categories categories) {
        this.categories = categories;
    }

    public Brands getBrands() {
        return brands;
    }

    public void setBrands(Brands brands) {
        this.brands = brands;
    }

    public List<SaleOff> getSaleOffList() {
        return saleOffList;
    }

    public void setSaleOffList(List<SaleOff> saleOffList) {
        this.saleOffList = saleOffList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (proID != null ? proID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Products)) {
            return false;
        }
        Products other = (Products) object;
        if ((this.proID == null && other.proID != null) || (this.proID != null && !this.proID.equals(other.proID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EC.Products[proID=" + proID + "]";
    }

}
